package kata;

//check if any number is prime, if true, then true
public class TheCubeImpl implements TheCube {

	private boolean primality(int testVal) {
		// returns true if number is prime
		double sqrtTestVal = Math.sqrt(testVal);
		for (int i = 2; i < sqrtTestVal+1; i++) {
			if (testVal % i == 0) {
				return false;
			}
		}
		return true;
	}

	@Override
	public boolean containsPrimeNumber(String code1, String code2, String code3) {
		return primality(Integer.parseInt(code1))
				|| primality(Integer.parseInt(code2))
				|| primality(Integer.parseInt(code3));
	}
}
